<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> -- 我的账号信息 </title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <include file="Index/common_css"/>
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h3>我的账号 ><small class="m-l-sm">账号信息</small></h3>
                <dl class="dl-horizontal pull-right">
                    <dt>账号状态：</dt>
                    <dd><span class="label label-primary">{$data.state}</span>
                    </dd>
                </dl>
            </div>

            <div class="col-sm-12">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">上传文件</a>
                        </li>
                        <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">重置CRM密码</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">重置MT4密码</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false">申请职位</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-5" aria-expanded="false">申请杠杆</a></li>
                    </ul>
                    <div class="tab-content">
                        <!--上传文件-->
                        <div id="tab-1" class="tab-pane active">
                            <form name="imgupload" id="imgupload" method="post" enctype="multipart/form-data">
                                <!--手持身份证-->
                                <div class="col-sm-4">
                                    <div class="ibox float-e-margins" >
                                        <div class="ibox-title">
                                            <h5>银行卡正面</h5>
                                        </div>

                                        <div  class="ibox-content" style="width:522px;height: 305px;">
                                            <a  class="example-image-link"  data-lightbox="example-1" data-title="银行卡正面">
                                                <img class="example-image" src="__ROOT__/{$data.front_img}" id="front" alt="未上传" style="width: 100%;height: 100%;"/>
                                            </a>
                                        </div>
                                        <div class="btn-group">
                                            <if condition="$data.status eq 1">
                                                <label title="上传图片" for="front_img" class="btn btn-primary">
                                                    <input type="file" accept="image/*" name="front_img" id="front_img"  class="hide">选择图片
                                                </label>
                                                <elseif condition="($data.status eq 2) or ($data.status eq 3)"/>
                                                <button title="下载图片" onclick="downloadImage('__ROOT__/{$data.front_img}')" class="btn btn-primary">下载</button>
                                                <elseif condition="$data.status eq 4" />
                                                <button title="删除图片" onclick="front_imgDelete(this,'{$data.user_id}');" class="btn btn-primary">删除重新上传</button>
                                            </if>
                                        </div>
                                    </div>
                                    <if condition="$data.status eq 1">
                                     <button title="上传图片" type="button" onclick="Imagelond()"  class="btn btn-primary">选择完毕后点击上传图片</button>
                                    </if>

                                </div>
                                <!--手持身份证/-->

                                <!--身份证正面-->
                                <div class="col-sm-4">
                                    <div class="ibox float-e-margins">
                                        <div class="ibox-title">
                                            <h5>身份证正面</h5>
                                        </div>
                                        <div class="ibox-content" style="width:522px;height: 305px;">
                                            <a class="example-image-link" data-lightbox="example-1" data-title="身份证正面">
                                                <img class="example-image" src="__ROOT__/{$data.hand_img}" id="hand" alt="未上传" style="width: 100%;height: 100%;"/>
                                            </a>
                                        </div>
                                        <div class="btn-group">
                                            <if condition="$data.status eq 1">
                                                <label title="上传图片" for="hand_img" class="btn btn-primary">
                                                    <input type="file" accept="image/*" name="hand_img" id="hand_img" class="hide">选择图片
                                                </label>
                                                <elseif condition="($data.status eq 2) or ($data.status eq 3)"/>
                                                <a title="下载图片" onclick="downloadImage('__ROOT__/{$data.hand_img}')"  class="btn btn-primary">下载</a>
                                                <elseif condition="$data.status eq 4" />
                                                <!--<button title="删除图片" onclick="front_imgDelete(this,'{$data.user_id}');" class="btn btn-primary">删除</button>-->
                                            </if>
                                        </div>
                                    </div>
                                </div>
                                <!--身份证正面/-->
                                <!--身份证背面-->
                                <div class="col-sm-4">
                                    <div class="ibox float-e-margins"  >
                                        <div class="ibox-title">
                                            <h5>身份证背面</h5>
                                        </div>
                                        <div class="ibox-content" style="width:522px;height: 305px;">
                                            <a  class="example-image-link"  data-lightbox="example-1" data-title="身份证背面">
                                                <img class="example-image" src="__ROOT__/{$data.behind_img}" id="behind" alt="未上传" style="width: 100%;height: 100%;"/>
                                            </a>
                                        </div>
                                        <div class="btn-group">
                                            <if condition="$data.status eq 1">
                                                <label title="上传图片" for="behind_img" class="btn btn-primary">
                                                    <input type="file" accept="image/*" name="behind_img" id="behind_img" class="hide">选择图片
                                                </label>
                                                <elseif condition="($data.status eq 2) or ($data.status eq 3)"/>
                                                <button title="下载图片" onclick="downloadImage('__ROOT__/{$data.behind_img}')"  class="btn btn-primary">下载</button>
                                                <elseif condition="$data.status eq 4" />
                                                <!--<button title="删除图片" onclick="front_imgDelete(this,'{$data.user_id}');" class="btn btn-primary">删除</button>-->
                                            </if>
                                        </div>
                                    </div>
                                </div>
                                <!--身份证背面/-->
                            </form>
                        </div>
                        <!--上传文件/-->
                        <!--重置CRM密码-->
                        <div id="tab-2" class="tab-pane">
                            <div class="panel-body">
                                    <form class="form-horizontal" action="" method="post">
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">验证方式：</label>
                                            <div class="col-sm-5">
                                                <div class="input-group">
                                                    <input type="text" value="{$data.user_email}" id="very_type" disabled class="form-control">

                                                    <span class="input-group-btn">
                                                        <input type="button" id="send" class="btn btn-primary" value="发送" />
                                                    </span>
                                                </div>
                                                <!--<a id="switch" style="float: left">使用手机号验证</a>-->
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">验证码：</label>
                                            <div class="col-sm-5">
                                                <input type="text" placeholder="验证码" name="very" id="very" maxlength="6" class="form-control" />
                                                <span class="help-block m-b-none" id="verify_alert" style="color: red;"></span>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">新密码：</label>
                                            <div class="col-sm-5">
                                                <input type="password" placeholder="新密码5-16位数字字母" maxlength="16" name="pwd" id="pwd" class="form-control" datatype="*" nullmsg="null" errormsg="&#xe706;" sucmsg=" "/>
                                                <span class="help-block m-b-none" id="pwd_alert" style="color: red;"></span>
                                            </div>

                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">确认密码：</label>
                                            <div class="col-sm-5">
                                                <input type="password" placeholder="确认密码" maxlength="16" name="repwd" id="repwd" class="form-control" datatype="*" recheck="pwd" nullmsg="null" errormsg="&#xe706;" sucmsg=" "/>
                                                <span class="help-block m-b-none" id="repwd_alert" style="color: red;"></span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-offset-3 col-sm-8">
                                                <button class="btn btn-sm btn-info" id="updatePwd" type="button">修 改</button>
                                            </div>
                                        </div>
                                    </form>
                            </div>
                        </div>
                        <!--重置CRM密码/-->
                        <!--重置MT PWD-->
                        <div id="tab-3" class="tab-pane">
                            <div class="panel-body">
                                <form class="form-horizontal"  action="" method="post">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">验证方式：</label>
                                        <div class="col-sm-5">
                                            <div class="input-group">
                                                <input type="text" value="{$data.user_email}" id="MT4_very_type" disabled class="form-control">

                                                <span class="input-group-btn">
                                                        <input type="button" id="MT4_send" class="btn btn-primary" value="发送" />
                                                    </span>
                                            </div>
                                            <!--<a id="MT4_switch" style="float: left">使用手机号验证</a>-->
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">验证码：</label>
                                        <div class="col-sm-5">
                                            <input type="text" placeholder="验证码" name="very" id="MT4_very" maxlength="6" class="form-control" />
                                            <span class="help-block m-b-none" id="MT4_verify_alert" style="color: red;"></span>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">MT4新密码：</label>
                                        <div class="col-sm-5">
                                            <input type="password" placeholder="新MT4密码必须为5-15位大小写字母加数字组成" maxlength="15" name="pwd" id="MT4_pwd" class="form-control" datatype="*" nullmsg="null" errormsg="&#xe706;" sucmsg=" "/>
                                            <span class="help-block m-b-none" id="MT4_pwd_alert" style="color: red;"></span>
                                        </div>

                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">MT4确认密码：</label>
                                        <div class="col-sm-5">
                                            <input type="password" placeholder="确认密码" maxlength="15" name="repwd" id="MT4_repwd" class="form-control" datatype="*" recheck="pwd" nullmsg="null" errormsg="&#xe706;" sucmsg=" "/>
                                            <span class="help-block m-b-none" id="MT4_repwd_alert" style="color: red;"></span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-offset-3 col-sm-8">
                                            <button class="btn btn-sm btn-info" id="MT4_updatePwd" type="button">修 改</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <!--重置MT PWD/-->
                        <!--申请职位-->
                        <div id="tab-4" class="tab-pane">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="ibox float-e-margins">
                                        <div class="ibox-title">
                                            <h5>我的职位：{$data.user_position}</h5>
                                            <div class="ibox-tools">
                                                <a class="collapse-link"  href="javascript:location.replace(location.href);" title="刷新">
                                                    <i class="fa fa-refresh"></i>
                                                </a>
                                            </div>
                                        </div>

                                        <div class="ibox-content">
                                            <div class="row">
                                                <div class="col-sm-1 m-b-xs">
                                                    <!--<a  href="My_data.html#position_apply" class="btn btn-w-m btn-success">申请职位</a>-->
                                                    <button class="btn btn-w-m btn-success" data-toggle="modal" data-target="#myModal1">申请职位</button>
                                                </div>
                                            </div>
                                            <div class="table-responsive">
                                                <table class="table table-striped">
                                                    <thead>
                                                    <tr>
                                                        <th>参考编号</th>
                                                        <th>申请时间</th>
                                                        <th>申请当天的职位</th>
                                                        <th>申请的职位</th>
                                                        <th>状态</th>
                                                        <th>操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <foreach name="postition_apply" item="pa">
                                                        <tr>
                                                            <td>{$pa.id}</td>
                                                            <td>{$pa.apply_time}</td>
                                                            <td>{$pa.currently}</td>
                                                            <td>{$pa.apply}</td>
                                                            <td>{$pa.state}</td>
                                                            <td>
                                                                <a title="编辑" onclick="Apply_detaiuls('查看详情','__MODULE__/MyAccount/Apply_details/id/{$pa.id}',606,600);">
                                                                    <i class="fa fa-search-plus text-navy"></i>
                                                                </a>
                                                                <a title="删除"  onclick="Position_delete(this,'{$pa.id}');"><i class="fa fa-trash text-navy"></i></a>
                                                            </td>
                                                        </tr>
                                                    </foreach>

                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--申请职位/-->
                        <!--申请杠杆-->
                        <div id="tab-5" class="tab-pane">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="ibox float-e-margins">
                                        <div class="ibox-title">
                                            <h5>我的杠杆：{$data.level}</h5>
                                            <div class="ibox-tools">
                                                <a class="collapse-link"  href="javascript:location.replace(location.href);" title="刷新">
                                                    <i class="fa fa-refresh"></i>
                                                </a>
                                            </div>
                                        </div>

                                        <div class="ibox-content">
                                            <div class="row">
                                                <div class="col-sm-1 m-b-xs">
                                                    <button class="btn btn-w-m btn-success" data-toggle="modal" data-target="#myModal2">申请杠杆变更</button>
                                                </div>
                                            </div>
                                            <div class="table-responsive">
                                                <table class="table table-striped">
                                                    <thead>
                                                    <tr>
                                                        <th>参考编号</th>
                                                        <th>申请时间</th>
                                                        <th>申请当天的杠杆</th>
                                                        <th>申请的杠杆</th>
                                                        <th>处理时间</th>
                                                        <th>状态</th>
                                                        <th>操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <foreach name="lever" item="le">
                                                        <tr>
                                                            <td>{$le.id}</td>
                                                            <td>{$le.apply_time|date="Y-m-d H:i:s",###}</td>
                                                            <td>{$le.current_lever}</td>
                                                            <td>{$le.apply_lever}</td>

                                                            <td>
                                                                <if condition="$le.hand_time eq null">-- --<else/>{$le.hand_time|date="Y-m-d H:i:s",###}</if>
                                                            </td>
                                                            <td>
                                                                <if condition="$le.state eq 1">
                                                                    <font color="#2f4f4f">待审核</font>
                                                                    <elseif condition="$le.state eq 2"/>
                                                                    <font color="green">已同意</font>
                                                                    <else/>
                                                                    <font color=red>已拒绝</font>
                                                                </if>
                                                            </td>
                                                            <td>
                                                                <a title="编辑" onclick="Apply_detaiuls('查看详情','__MODULE__/MyAccount/Apply_lever/id/{$le.id}',606,600);">
                                                                    <i class="fa fa-search-plus text-navy"></i>
                                                                </a>
                                                                <a title="删除"  onclick="Lever_delete(this,'{$le.id}');"><i class="fa fa-trash text-navy"></i></a>
                                                            </td>
                                                        </tr>
                                                    </foreach>

                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--申请杠杆/-->
                    </div>
                    <!--职位申请隐藏层-->
                    <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <form action="" method="post" enctype="multipart/form-data" name="form1" id="myform">
                                <div class="modal-content">

                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                        <h4 class="modal-title" id="myModalLabel">职位 申请</h4>
                                    </div>

                                    <div class="modal-body" style="padding: 15px 30px 5px;">
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label">MT4账号：</label>
                                            <label class="col-sm-4 control-label">{$data.user_id}</label>
                                        </div>
                                    </div>

                                    <div class="modal-body" style="padding: 15px 30px 5px;">
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label">目前职位：</label>
                                            <label class="col-sm-4 control-label">{$data.user_position}</label>
                                        </div>
                                    </div>
                                    <div class="modal-body" style="padding: 15px 30px 25px;">
                                        <label class="col-sm-4 control-label">申请职位：</label>
                                        <div class="col-sm-6">
                                            <select class="form-control" style="height: 32px;" name="apply_position" id="apply_position">
                                                <foreach name="postition" item="po">
                                                    <option value="{$po.id}" <if condition="$data['position'] eq $po['id']">selected="selected"</if>>{$po.user_position}</option>
                                                </foreach>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="modal-body">
                                        <label class="col-sm-4 control-label">详细说明：</label>
                                        <div class="col-sm-6">
                                            <textarea id="notes" name="notes" style="width:240px;height: 60px;"></textarea>
                                        </div>
                                    </div>
                                    <div class="modal-footer" style="border-top:0px;">
                                        <a type="button" class="btn btn-default" onclick="position();" id="loading-example-btn">提交</a>
                                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!--职位申请杠杆隐藏层-->
                    <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <form action="" method="post" enctype="multipart/form-data" name="form1" id="myform2">
                                <div class="modal-content">

                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                        <h4 class="modal-title" id="myModalLabel2">职位 杠杆</h4>
                                    </div>

                                    <div class="modal-body" style="padding: 15px 30px 5px;">
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label">MT4账号：</label>
                                            <label class="col-sm-4 control-label">{$data.user_id}</label>
                                        </div>
                                    </div>

                                    <div class="modal-body" style="padding: 15px 30px 5px;">
                                        <div class="form-group">
                                            <label class="col-sm-4 control-label">目前 杠杆：</label>
                                            <label class="col-sm-4 control-label">1:{$data.level}</label>
                                        </div>
                                    </div>
                                    <div class="modal-body" style="padding: 15px 30px 25px;">
                                        <label class="col-sm-4 control-label">申请 杠杆：</label>
                                        <div class="col-sm-6">
                                            <select class="form-control" style="height: 32px;" name="apply_lever" id="apply_lever">
                                                <option value="0" <if condition="$data['level'] eq 0">selected="selected"</if>>0</option>
                                                <option value="50" <if condition="$data['position'] eq 50">selected="selected"</if>>1:50</option>
                                                <option value="100" <if condition="$data['position'] eq 100">selected="selected"</if>>1:100</option>
                                                <option value="200" <if condition="$data['position'] eq 200">selected="selected"</if>>1:200</option>
                                                <option value="300" <if condition="$data['position'] eq 300">selected="selected"</if>>1:300</option>
                                                <option value="400" <if condition="$data['position'] eq 400">selected="selected"</if>>1:400</option>
                                                <option value="500" <if condition="$data['position'] eq 500">selected="selected"</if>>1:500</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="modal-body">
                                        <label class="col-sm-4 control-label">详细说明：</label>
                                        <div class="col-sm-6">
                                            <textarea id="notes2" name="notes" style="width:240px;height: 60px;"></textarea>
                                        </div>
                                    </div>
                                    <div class="modal-footer" style="border-top:0px;">
                                        <a type="button" class="btn btn-default" onclick="lever();" id="loading-example-btn2">提交</a>
                                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<!-- 全局js -->
<include file="Index/common_js"/>
<!-- Peity -->
<script src="__PUBLIC__/admin/js/plugins/peity/jquery.peity.min.js"></script>
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/common/js/layer_show.js"></script>
<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="__PUBLIC__/admin/js/plugins/layer/laydate/laydate.js"></script>
<script>
    //图片下载
    function downloadImage(src) {
        var $a = $("<a></a>").attr("href", src).attr("download", "my.png");
        $a[0].click();
    }
    //图片上传预览
    $("#front_img").change(function () {
        var r= new FileReader();
        f = document.getElementById('front_img').files[0];
        r.readAsDataURL(f);
        r.onload=function  (e) {
            $('#front').attr('src',this.result);}});
    $("#hand_img").change(function () {
        var r= new FileReader();
        f = document.getElementById('hand_img').files[0];
        r.readAsDataURL(f);
        r.onload=function  (e) {
            $('#hand').attr('src',this.result);}});
    $("#behind_img").change(function () {
        var r= new FileReader();
        f = document.getElementById('behind_img').files[0];
        r.readAsDataURL(f);
        r.onload=function  (e) {
            $('#behind').attr('src',this.result);}});
    function Imagelond(){
        var front_img = $("#front_img").val();
        var hand_img = $("#hand_img").val();
        var behind_img = $("#behind_img").val();
        if(front_img==''||hand_img==''||behind_img==''){
            layer.msg("请选择图片后在上传");return;
        }
        var index = layer.load(0, {shade: false});
        var form = document.getElementById('imgupload');
        fdata = new FormData(form);
        XHR = new XMLHttpRequest();
        XHR.open('POST','__MODULE__/MyAccount/img_upload',true);
        XHR.onreadystatechange=function(){
            if(XHR.readyState == 4) {
                layer.close(index);layer.msg(XHR.responseText, {time: 1000});setTimeout(function () {location.reload();}, 1100);
            }
        };
        XHR.send(fdata);
    }
    //删除图片
    function front_imgDelete(obj,id) {
        var front_img ='{$data.front_img}';
        var behind_img ='{$data.behind_img}';
        var hand_img    =  '{$data.hand_img}';
        var index = layer.load(0, {shade: false});
        $.ajax({
            type:"POST",
            url:"__MODULE__/MyAccount/img_delete",
            dataType:'json',
            data:{id:id,front:front_img,behind:behind_img,hand:hand_img},
            success:function(data){
                layer.close(index);
                if(data.status==1){
                    layer.msg(data.msg);setTimeout(function () {location.reload();}, 1000);
                }else if(data.status==0){
                    layer.error(data.error);
                }else{
                    layer.msg('网络错误',{icon: 2, time: 2000});
                }
            },error:function(err){
                layer.close(index);
                layer.msg('error:网络错误',{icon: 2, time: 2000});
            }
        });
    }
   // var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
    //CRM---password_save
    $(document).ready(function () {
        /*$("#switch").on('click',function () {       //switch-切换
            var now =  $("#very_type").val();
            var phone = '{$data.user_phone}';
            var email = '{$data.user_email}';
            if(now==''||phone==''||email==''){
                layer.msg("error");return;
            }else if(now==email){
                $("#very_type").val(phone);
                $("#switch").html("使用邮箱发送");
            }else{
                $("#very_type").val(email);
                $("#switch").html("使用手机号发送");
            }});
*/

        $("#send").on('click',function () {         //send--发送
            var index = layer.load(0, {shade: false});
            var count =60;
            var countdown = setInterval(CountDown, 1000);
            function CountDown() {
                $("#send").attr("disabled", true);
                $("#send").val(count + " 秒后重新发送");
                if (count == 0) {$("#send").val("重新发送").removeAttr("disabled");
                    clearInterval(countdown);}count--;
            }
            var data = $("#very_type").val();
            if(data){
                $.ajax({
                    type:"POST",
                    url:"__MODULE__/MyAccount/very_send",
                    dataType:'json',
                    data:{data:data},
                    success:function(data){
                        layer.close(index);
                        if(data.status==1){
                            layer.msg(data.msg);
                        }else if(data.status==0){
                            layer.error(data.error);
                        }else{
                            layer.msg('网络错误',{icon: 2, time: 2000});
                        }
                    },error:function(err){
                        layer.close(index);
                        layer.msg('error:网络错误',{icon: 2, time: 2000});
                    }
                });
            }
        });
        var not1= false;
        $('#very').bind('mouseout',function() {
            var very =  $(this).val();
            if(very){
                $.ajax({
                    type:"POST",
                    url:"__MODULE__/MyAccount/Verification",
                    dataType:'json',
                    data:{very:very},
                    success:function(data){
                        if(data.status==1){
                            $("#very").css("border-color","#23b7e5");
                            $("#verify_alert").html('');
                            not1= true;
                        }else if(data.status==0){
                            $("#verify_alert").html('<i class="fa fa-info-circle"></i>'+data.error);
                        }else{
                            layer.msg('网络错误',{icon: 2, time: 2000});
                        }
                    },error:function(err){
                        //layer.close(index);
                        layer.msg('error:网络错误',{icon: 2, time: 2000});
                    }
                });

            }else {
                $("#verify_alert").html('<i class="fa fa-info-circle"></i>'+'必填');
            }
        });
        $("#updatePwd").on('click',function () {
            if(not1){
                var pwd = $("#pwd").val();
                var repwd = $("#repwd").val();
                var str =/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/;
                if(pwd==''){
                    $("#pwd_alert").html('<i class="fa fa-info-circle"></i>'+'必填');
                }else if(repwd==''){
                    $("#repwd_alert").html('<i class="fa fa-info-circle"></i>'+'必填');return;
                }
                if(str.test(pwd)){
                    if(pwd==repwd){
                        var index = layer.load(0, {shade: false});
                        $.ajax({
                            type:"POST",
                            url:"__MODULE__/MyAccount/password_save",
                            dataType:'json',
                            data:{pwd:pwd,repwd:repwd},
                            success:function(data){
                                layer.close(index);
                                if(data.status==1){
                                    layer.msg(data.msg);setTimeout(function () {location.reload();}, 1000);
                                }else if(data.status==0){
                                    layer.msg(data.error);
                                }else{
                                    layer.msg('网络错误',{icon: 2, time: 2000});
                                }
                            },error:function(err){
                                layer.close(index);
                                layer.msg('error:网络错误',{icon: 2, time: 2000});
                            }
                        });
                    }else{
                        $("#repwd_alert").html('<i class="fa fa-info-circle"></i>'+'两次输入不一致');return;
                    }
                }else{
                    $("#pwd_alert").html('<i class="fa fa-info-circle"></i>'+'密码格式不正确');
                }
            }else{
                $("#very").css("border-color","#e54a45");
            }

        })
    });
    //MT----PASSWORD Save
    $(document).ready(function () {
        /*$("#MT4_switch").on('click',function () {       //switch-切换
            var now =  $("#MT4_very_type").val();
            var phone = '{$data.user_phone}';
            var email = '{$data.user_email}';
            if(now==''||phone==''||email==''){
                layer.msg("error");return;
            }else if(now==email){
                $("#MT4_very_type").val(phone);
                $("#MT4_switch").html("使用邮箱发送");
            }else{
                $("#MT4_very_type").val(email);
                $("#MT4_switch").html("使用手机号发送");
            }});*/
        var not1= false;
        $("#MT4_send").on('click',function () {         //send--发送
            var index = layer.load(0, {shade: false});
            var count =60;
            var countdown = setInterval(CountDown, 1000);
            function CountDown() {
                $("#MT4_send").attr("disabled", true);
                $("#MT4_send").val(count + " 秒后重新发送");
                if (count == 0) {$("#MT4_send").val("重新发送").removeAttr("disabled");
                    clearInterval(countdown);}count--;
            }
            var data = $("#MT4_very_type").val();
            if(data) {
                $.ajax({
                    type: "POST",
                    url: "__MODULE__/MyAccount/very_send",
                    dataType: 'json',
                    data: {data: data},
                    success: function (data) {
                        layer.close(index);
                        if (data.status == 1) {
                            layer.msg(data.msg);
                        } else if (data.status == 0) {
                            layer.error(data.error);
                        } else {
                            layer.msg('网络错误', {icon: 2, time: 2000});
                        }
                    }, error: function (err) {
                        layer.close(index);
                        layer.msg('error:网络错误', {icon: 2, time: 2000});
                    }
                });
            }
        });
        $('#MT4_very').bind('mouseout',function() {
            var very =  $(this).val();
            if(very){
                $.ajax({
                    type:"POST",
                    url:"__MODULE__/MyAccount/Verification",
                    dataType:'json',
                    data:{very:very},
                    success:function(data){
                        if(data.status==1){
                            $("#MT4_very").css("border-color","#23b7e5");
                            $("#MT4_verify_alert").html('');
                            not1= true;
                        }else if(data.status==0){
                            $("#MT4_verify_alert").html('<i class="fa fa-info-circle"></i>'+data.error);
                        }else{
                            layer.msg('网络错误',{icon: 2, time: 2000});
                        }
                    },error:function(err){
                        layer.msg('error:网络错误',{icon: 2, time: 2000});
                    }
                })
            }else {
                $("#MT4_verify_alert").html('<i class="fa fa-info-circle"></i>'+'必填');
            }
        });

        $("#MT4_updatePwd").on('click',function () {
            var indx = layer.load(0, {shade: false});
            if(not1){
                var pwd = $("#MT4_pwd").val();
                var repwd = $("#MT4_repwd").val();
                var reg = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{5,15}$/;
                if(pwd==''){
                    $("#MT4_pwd_alert").html('<i class="fa fa-info-circle"></i>'+'必填');
                }else if(repwd==''){
                    $("#MT4_repwd_alert").html('<i class="fa fa-info-circle"></i>'+'必填');return;
                }
                if(reg.test(pwd)){
                    if(pwd==repwd){
                        $.ajax({
                            type:"POST",
                            url:"__MODULE__/MyAccount/mt4_password_save",
                            dataType:'json',
                            data:{pwd:pwd,repwd:repwd},
                            success:function(data){
                                layer.close(indx);
                                if(data.status==1){
                                    layer.msg(data.msg);setTimeout(function () {location.reload();}, 1000);
                                }else if(data.status==0){
                                    layer.msg(data.error);
                                }else{
                                    layer.msg('网络错误',{icon: 2, time: 2000});
                                }
                            },error:function(err){
                                layer.close(indx);
                                layer.msg('error:网络错误',{icon: 2, time: 2000});
                            }
                        });
                    }else{
                        layer.close(indx); $("#MT4_repwd_alert").html('<i class="fa fa-info-circle"></i>'+'两次输入不一致');return;
                    }
                }else{
                    layer.close(indx);$("#MT4_pwd_alert").html('<i class="fa fa-info-circle"></i>'+'密码格式不正确');
                }
            }else{
                layer.close(indx);$("#MT4_very").css("border-color","#e54a45");
            }
        })
    });
    // Position Apply
    function position() {
        var apply_position = $("#apply_position").val();
        var notes = $("#notes").val();
        if(notes==''){
            layer.msg('详细说明不能为空');return;
        }else{
            var index = layer.load(0, {shade: false});
            $.ajax({
                type:"POST",
                url:"__MODULE__/MyAccount/position_apply",
                dataType:'json',
                data:{apply_position:apply_position,notes:notes},
                success:function(data){
                    layer.close(index);
                    if(data.status==1){
                       layer.msg(data.msg);setTimeout(function () {location.reload();}, 1000);
                    }else if(data.status==0){
                        layer.msg(data.error);
                    }else{
                        layer.msg('网络错误',{icon: 2, time: 2000});
                    }
                },error:function(err){
                    layer.close(index);
                    layer.msg('error:网络错误',{icon: 2, time: 2000});
                }
            });
        }
    }
    // Position Delete
    function Position_delete(obj,id) {
        layer.confirm('确认删除吗？', function () {
            if (id == '') {
                layer.msg('操作错误，请刷新再试');
                return false;
            } else {
                var index = layer.load(0, {shade: false});
                $.ajax({
                    type:"POST",
                    url:"__MODULE__/MyAccount/Apply_positionDelete",
                    dataType:'json',
                    data:{id: id},
                    success:function(data){
                        layer.close(index);
                        if(data.status==1){
                            layer.msg(data.msg);$(obj).parents("tr").remove();
                        }else if(data.status==0){
                            layer.msg(data.error);
                        }else{
                            layer.msg('网络错误',{icon: 2, time: 2000});
                        }
                    },error:function(err){
                        //console.log(err);
                        layer.close(index);
                        layer.msg('error:网络错误',{icon: 2, time: 2000});
                    }
                });
            }
        })
    }
    //Lever Apply
    function lever() {
        var apply_lever = $("#apply_lever").val();
        var notes = $("#notes2").val();
        if(notes==''){
            layer.msg('详细说明不能为空');return;
        }else{
            var index = layer.load(0, {shade: false});
            $.ajax({
                type:"POST",
                url:"__MODULE__/MyAccount/apply_lever_add",
                dataType:'json',
                data:{apply_lever:apply_lever,notes:notes},
                success:function(data){
                    //console.log(data);
                    layer.close(index);
                    if(data.status==1){
                        layer.msg(data.msg);setTimeout(function () {location.reload();}, 1000);
                    }else if(data.status==0){
                        layer.msg(data.error);
                    }else{
                        layer.msg('网络错误',{icon: 2, time: 2000});
                    }
                },error:function(err){
                    //console.log(err);
                    layer.close(index);
                    layer.msg('error:网络错误2',{icon: 2, time: 2000});
                }
            });
        }
    }
    //Lever Delete
    function Lever_delete(obj,id){
        layer.confirm('确认删除吗？', function () {
            if (id == '') {
                layer.msg('操作错误，请刷新再试');return false;
            } else {
                var index = layer.load(0, {shade: false});
                $.ajax({
                    type:"POST",
                    url:"__MODULE__/MyAccount/Apply_LeverDelete",
                    dataType:'json',
                    data:{id: id},
                    success:function(data){
                        layer.close(index);
                        if(data.status==1){
                            layer.msg(data.msg);$(obj).parents("tr").remove();
                        }else if(data.status==0){
                            layer.msg(data.error);
                        }else{
                            layer.msg('网络错误',{icon: 2, time: 2000});
                        }
                    },error:function(err){
                        //console.log(err);
                        layer.close(index);
                        layer.msg('error:网络错误',{icon: 2, time: 2000});
                    }
                });
            }
        })
    }
    function Apply_detaiuls(title,url,w,h) {
        layer_show(title,url,w,h);
    }
</script>
</body>
</html>
